<template name="blogAdmin">
  <div class="meteor-blog-admin">
    <div class="container meteor-blog-admin-index">
      <div class="row">
        <div class="col-md-3">
          <h1>{{BlogLanguage.adminHeader}}</h1>
        </div>
        <div class="col-md-9">
          <a href="#" data-action="new-blog" class="btn btn-default">
            <i class="fa fa-plus"></i> {{BlogLanguage.addPost}}
          </a>
          <select data-action="filtering" class="form-control">
            <option value="all">{{BlogLanguage.allPosts}}</option>
            <option value="mine">{{BlogLanguage.myPosts}}</option>
          </select>
        </div>
      </div>
      <div class="row">
        <div class="col-md-12">
          {{#if subsReady}}
            {{#if posts}}
              {{> reactiveTable collection=posts settings=table}}
            {{else}}
              <a href="#" data-action="new-blog">{{BlogLanguage.createFirst}}</a>
            {{/if}}
          {{else}}
            {{> blogLoading}}
          {{/if}}
        </div>
      </div>
    </div>
  </div>
</template>

<template name="blogAdminTitleColumn">
  <h4><a target="_blank" href="{{blogPathFor 'blogShow'}}">{{title}}</a></h4>
  <p>{{{excerpt}}}</p>
</template>

<template name="blogAdminAuthorColumn">
  {{authorName}}
</template>

<template name="blogAdminUpdatedColumn">
  {{blogFormatDate updatedAt}}
</template>

<template name="blogAdminPublishedColumn">
  {{#if publishedAt}}
    {{blogFormatDate publishedAt}}
  {{else}}
    <i class="fa fa-ban"></i>
  {{/if}}
</template>

<template name="blogAdminVisibleColumn">
  <select data-action="visibility" class="form-control input-sm">
    <option value="draft" selected={{isSelected "draft"}}>{{BlogLanguage.postVisibilityAdmins}}</option>
    <option value="private" selected={{isSelected "private"}}>{{BlogLanguage.postVisibilityLink}}</option>
    <option value="public" selected={{isSelected "public"}}>{{BlogLanguage.postVisibilityAnyone}}</option>
  </select>
</template>

<template name="blogAdminEditColumn">
  <a href="{{blogPathFor 'blogAdminEdit'}}"><i class="fa fa-edit"></i></a>
</template>

<template name="blogAdminDeleteColumn">
  <a href="#" data-action="delete"><i class="fa fa-trash-o"></i></a>
</template>
